package com.echat.serviceapigateway;

import com.echat.serviceapigateway.security.constant.Constants;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.netflix.zuul.EnableZuulProxy;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.session.data.redis.config.annotation.web.http.EnableRedisHttpSession;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import tk.mybatis.spring.annotation.MapperScan;


@EnableZuulProxy
@EnableDiscoveryClient
@EnableRedisHttpSession(maxInactiveIntervalInSeconds = Constants.TIME_ONE_HOUR)
@EnableCaching
@EnableTransactionManagement
@Configuration
@MapperScan(basePackages = {"com.echat.serviceapigateway.security.mapper"})
@ComponentScan("com.echat")
@SpringBootApplication(exclude = {SecurityAutoConfiguration.class})
public class ServiceApiGatewayApplication extends SpringBootServletInitializer {

	public static void main(String[] args) {
		SpringApplication.run(ServiceApiGatewayApplication.class, args);
	}

	@Override
	protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
		return builder.sources(ServiceApiGatewayApplication.class);
	}

}
